package com.example.multithread;

import java.util.concurrent.atomic.DoubleAccumulator;
import java.util.concurrent.atomic.DoubleAdder;

public class ConcurrentComputingTest {
    public static void main(String[] args) {
        DoubleAccumulator da = new DoubleAccumulator((x, y) -> x + y, 1.1);
        da.accumulate(23);
        System.out.println("【累加器】新的存储内容: " + da.doubleValue());

        DoubleAdder da2 = new DoubleAdder();
        da2.add(10);
        da2.add(20);
        da2.add(30);
        System.out.println("【加法器】计算结果: " + da2.doubleValue());
    }
}
